package com.kedacom.demo.rabbitmq_java_client.ch2.workqueues;

import net.sf.json.JSONObject;

public class SimpleTask {

	private String name;
	private int secondsWillBeTaken;

	public SimpleTask() {
		super();
	}

	public SimpleTask(String name, int secondsWillBeTaken) {
		this();
		this.name = name;
		this.secondsWillBeTaken = secondsWillBeTaken;
	}

	public String toJson() {
		return JSONObject.fromObject(this).toString();
	}

	public static SimpleTask fromJson(String json) {
		return (SimpleTask) JSONObject.toBean(JSONObject.fromObject(json), SimpleTask.class);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getSecondsWillBeTaken() {
		return secondsWillBeTaken;
	}

	public void setSecondsWillBeTaken(int secondsWillBeTaken) {
		this.secondsWillBeTaken = secondsWillBeTaken;
	}

}
